package org.projects.graduates.domain;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.dayatang.domain.AbstractEntity;
import com.dayatang.domain.QuerySettings;

/**
 * 对作业的评论
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "homework_comments")
public class HomeworkComment extends AbstractEntity {

	private static final long serialVersionUID = 1043750832630917606L;
	// 哪次作业成绩
	@ManyToOne
	private HomeworkHandin handin;

	// 评论时间
	private Date time;

	// 评论人
	@OneToOne
	private Person person;

	// 评论的内容
	private String content;

	public static List<HomeworkComment> findBy(HomeworkHandin handin ) {
		return getRepository().find(QuerySettings.create(HomeworkComment.class).eq("handin", handin));
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public boolean equals(Object other) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}

	public HomeworkHandin getHandin() {
		return handin;
	}

	public void setHandin(HomeworkHandin handin) {
		this.handin = handin;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

}
